import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import operate from '@dfeidao/atom-nodejs/db/operate';
import { systemid, productid } from '../../atom/config';
interface Message {
	filter: {
		risk_po_name_no: string[]
	}
}

interface IWebResult {
	data: unknown;
	cookie?: {
		[name: string]: string;
	} | null;
	content_type?: string;
	headers?: {
		[key: string]: string;
	};
	attachment?: string;
	redirect?: string;
	status_code?: number;
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders): Promise<IWebResult> {
	log('Service begin path:e:\Feidao\kh\src\risk-point\zj-000012\s001,action_id:' + action_id);


	const d = operate(action_id, session_id, systemid);
	d.del('risk_point_name', { productid, risk_po_name_no: { $in: message.filter.risk_po_name_no } });

	const res2 = await d.exec();

	log('Service end path:e:\Feidao\kh\src\risk-point\zj-000012\s001,action_id:' + action_id);
	return {
		data: res2
	};
}
